<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<%@taglib prefix="code" tagdir="/WEB-INF/tags"%>
<%--<script type="text/javascript" src="<c:url value="/script/wangEditor/wangEditor.min.js"/>"></script>--%>
<script type="text/javascript" src="<c:url value="/script/ueditor/ueditor.config.js"/>"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="<c:url value="/script/ueditor/ueditor.all.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/script/ueditor/lang/zh-cn/zh-cn.js"/>"></script>
<link rel="stylesheet" type="text/css"  href="<c:url value="/script/ueditor/themes/default/css/ueditor.css"/>" />
<div style="margin:20px 0;"></div>
<div class="easyui-panel">
	<div style="padding:10px 60px 20px 60px">
		<form id="heleForm"  name="heleForm" method="post" action="<c:url value='/help/saveHelpDetail.do'/>">
			<input type="hidden" id="help_uuid" name="help_uuid" value="${infEntity.help_uuid}"/>
			<input type="hidden" id="ins_uuid" name="ins_uuid" value="${infEntity.ins_uuid}"/>
			<input type="hidden" id="rec_id" name="rec_id" value="${infEntity.rec_id}"/>
			<%--<div id="content" style="display:none;">${infEntity.content}</div>--%>
			<table cellpadding="5" style="width:100%">
				<tr>
					<td>帮助信息标题:</td>
					<td><input class="easyui-textbox" type="text"  name="title" data-options="required:true,validType:['length[0,120]']" value="${infEntity.title}"></input></td>
				</tr>
				<tr>
					<td>帮助信息类型:</td>
					<td><code:codeSelect id="help_tp" name="help_tp" showSelect="true"  code_type="HELP_TP" selectId="${infEntity.help_tp}"></code:codeSelect></td>
				</tr>
				<tr>
					<td>所属机构:</td>
					<td>
						<input class="easyui-textbox" type="text" data-options="required:true" readonly="readonly" id="inst_name" value="${infEntity.inst_name}"/>
						<a href="javascript:void(0)" class="easyui-linkbutton detail-remove" iconCls="icon-search" id="selelctBtn">选择</a>
					</td>
				</tr>
				<tr>
					<td>内容:</td>
					<td>
						<div style="width:70%">
							<script id="newsEditor" name="content" type="text/plain">${infEntity.content}</script>
						</div>
					</td>
				</tr>
			</table>

			<div style="text-align:center;padding:5px">
				<a href="javascript:void(0)" class="easyui-linkbutton btn detail-remove" id="saveBtn" iconCls="icon-save" onclick="submitForm()">保存</a>
				<a href="javascript:void(0)" class="easyui-linkbutton btn" iconCls="icon-back" onclick="back()">返回</a>
			</div>
		</form>
	</div>
</div>
<div id="menuTree">
	<div id="ztreeObj" class="ztree"></div>
</div>
<script>

    var ztreeObj;
    /*选择按钮*/
    $("#selelctBtn").click(function(){
        ztreeObj = showAppTree(selected, $("#ins_uuid").val());
    });

    /*确定按钮回调*/
    function selected(){
        var nodes = ztreeObj.getSelectedNodes();
        console.log(nodes);
        if(nodes && nodes.length > 0){
            $("#inst_name").textbox("setValue", nodes[0].NAME);
            $("#ins_uuid").val(nodes[0].ID);
        }
    }
    function showAppTree(confirmCallback, uuid, option){
        var options = {
            url: "../organization/getAppInfTree.do",
            title: "选择机构",
            confirmCallback: confirmCallback,
            openIds: uuid,
            showSearch: true,
            searchTitle: "机构代码/名称"
        };
        options = $.extend({}, options, option);
        return showTree(options);
    }
    function showTree(options){
        var jpTree = $().jpTree(options);
        return jpTree;
    }

    var ue = UE.getEditor('newsEditor');
    //表单提交
    function submitForm(){
        //设置内容
        /*  $("#hide_content").val(newsEditor.txt.html());*/
        var html = ue.getContent();
		$("#newsEditor").val(html);
        //提交
        $("#heleForm").submit();
    }

</script>